package cn.com.roy.thread.t4_1_9.fairnofairtest;

public class RunNoFair {
    public static void main(String[] args) {
        try {
            final MyService service = new MyService(false);
            Runnable runnable = new Runnable() {
                public void run() {
                    System.out.println(Thread.currentThread().getName() + "运行了");
                    service.testMethod();
                }
            };
            Thread[] threads = new Thread[10];
            for (int i = 0; i < 10; i++) {
                threads[i] =  new Thread(runnable);
            }

            for (int i = 0; i < 10; i++) {
                threads[i].start();
                Thread.sleep(0);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }



}
